package cn.gson.crm.controller;

import cn.gson.crm.model.service.CheckService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/CheckController")
public class CheckController {
    @Autowired
    CheckService checkService;

    @RequestMapping("/selectCheck")
    @ResponseBody
    public Map<String,Object> selectCheck(Integer currentPage, Integer pageSize,String type,String leix){
        Page<Object> obj= PageHelper.startPage(currentPage,pageSize);
        checkService.selectCheck(type,leix);
        Map<String,Object> map=new HashMap<>();
        map.put("total",obj.getTotal());
        map.put("row",obj.getResult());
        return map;
    }
    //传值到后台进行查询
    @RequestMapping("/selectCheck2")
    @ResponseBody
    public Map<String,Object> selectCheck2(Integer checkId){
        System.out.println("111"+checkId);
        return checkService.chuan(checkId);
    }
    //修改，传id，时间，状态到后台
    @RequestMapping("/updateCheck3")
    @ResponseBody
    public void updateCheck3(Integer checkId, String checkSpDate,String checkCondition,Long checkName,String checkType){
        checkService.updateCheck3(checkId,checkSpDate,checkCondition,checkName,checkType);
    }
}
